import React, { Component } from 'react';
import PropTypes from 'prop-types';

class StatusPanel extends Component {
  constructor(props) {
    super(props);
  }

  componentWillReceiveProps(nextProps) {
    if (nextProps.isShow) {
      document.body.style.overflow = 'hidden';
    } else {
      document.body.style.overflow = 'auto';
    }
  }

  render() {
    let isShow = `status-panel${this.props.isShow ? ' open' : ''}`;
    return (
      <div className={isShow}>
        <div className="content">
          {this.props.children}
        </div>
      </div>
    )
  }

  static get propTypes() {
    return {
      isShow: PropTypes.bool,
      children: PropTypes.any
    }
  }
}


export default StatusPanel;
